<script setup lang="ts">
  import { cn } from '@renderer/lib/utils'
  import { ChevronDown } from 'lucide-vue-next'
  import { NavigationMenuTrigger, type NavigationMenuTriggerProps, useForwardProps } from 'reka-ui'
  import { computed, type HTMLAttributes } from 'vue'
  import { navigationMenuTriggerStyle } from '.'

  const props = defineProps<NavigationMenuTriggerProps & { class?: HTMLAttributes['class'] }>()

  const delegatedProps = computed(() => {
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const { class: _, ...delegated } = props

    return delegated
  })

  const forwardedProps = useForwardProps(delegatedProps)
</script>

<template>
  <NavigationMenuTrigger
    data-slot="navigation-menu-trigger"
    v-bind="forwardedProps"
    :class="cn(navigationMenuTriggerStyle(), 'group', props.class)"
  >
    <slot />
    <ChevronDown
      class="ml-1 size-3 transition duration-300 top-[1px] relative group-data-[state=open]:rotate-180"
      aria-hidden="true"
    />
  </NavigationMenuTrigger>
</template>
